<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('（网络理政区市县）待受理来信M')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            流水号：<input type="text" name="wsCode"/>
                        </li>
                        <li>
                            来信人名：<input type="text" name="fromName"/>
                        </li>
                        <li>
                            联系电话：<input type="text" name="fromTel"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm " id="toolbar" role="group">

            <a class="btn btn-primary single disabled" onclick="$.operate.detailTab()">
                <i class="fa fa-edit"></i> 查看
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.editTab()">
                <i class="fa fa-edit"></i> 处理
            </a>
            <a class="btn btn-success single disabled" onclick="printX()">
                <i class="fa fa-print"></i> 打印督办单
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "system/wsMail";

    function printX() {
        var url = prefix+"/printSends";
        let row = $("#bootstrap-table").bootstrapTable('getSelections');
        if (row.length < 2) {
            url += "?ids="+row[0].myPkVal;
        }else {
            var ids = '';
            for (let i = 0; i < row.length; i++) {
                ids += row[i].myPkVal;
                if ((i+1) != row.length) {
                    ids += ","
                }
            }
            url += "?ids="+ids;
        }
        window.open(url,"printX",'left=100,top=20,height=700,width=720,toolbar=yes,menubar=yes,scrollbars=auto');
    }

    $(function () {
        var options = {
            url: prefix + "/listWaitGetXZJson",
            updateUrl: prefix + "/mailGetDealXZ/{id}",
            detailUrl: prefix + "/editMail/{id}",
            sortName: "pkId",
            sortOrder: "desc",
            uniqueId: "myPkVal",
            modalName: "待受理来信",
            fixedColumns:true,
            fixedNumber: 2,
            fixedRightNumber: 1,
            columns: [{
                checkbox: true
            },
                {field:'myPkVal',title:'pkid',visible:false},
                {field:'WsCode',title:'流水号',align:'center',sortable:true},
                {field:'SpareString',title:'信件来源',align:'center',sortable:true},
                {field:'FromTopic',title:'主题',align:'center',sortable:true,
                    formatter:function (value, row, index,field) {
                        return "<span style='cursor: pointer;' title='"+value+"'>"+value+"</span>"
                    },
                    cellStyle: cellEllipsis
                },
                {field:'FmAreaName',title:'地区',align:'center',sortable:true},
                {field:'FromName',title:'来信人',align:'center'},
                {field:'FromTel',title:'联系电话',align:'center'},
                {field:'DFmClaName',title:'诉求',align:'center',visible:false},
                {field:'DCntAName',title:'内容类别',align:'center',sortable:true},
                {field:'FromTime',title:'来信时间',align:'center',sortable:true},
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.myPkVal + '\')">处理</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

</script>
</body>
</html>